<?php $this->load->view('header'); ?>
<script type="text/javascript" src="<?php echo base_url();?>scripts/jwplayer.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#pagination').smartpaginator({ totalrecords: <?php echo count($videos); ?>, recordsperpage: 5, length: 5, datacontainer: 'data_video', dataelement: 'video', initval: 0, next: 'Next', prev: 'Prev', first: 'First', last: 'Last'});
    });
</script>
<div id="title_background">
            <div class="wrapper"><!-- 900px wrapper -->
                
            	<h1>Galeri Video</h1>
                <!--<span class="title_description">Daftar Video.</span>-->
                
            </div> <!-- 900px wrapper -->
        </div>
   	
	</div>
    <div class="cleaner"></div>
    <div id="position_navi"><a href="index.html">Beranda</a> / Video</div>
    <div id="content">
    
    <div id="sidebar_right">
    	<?php $this->load->view('right_sidebar', $right_sidebar);?>
    </div>
    <?php	if($videos){ foreach($videos as $video){?>
   		<article class="sidebar_right">
        	<h2 class="blog_post_title"><a href="<?php echo base_url();?>videos/detail/<?php echo $video['id_video']?>">
			<?php echo $video['judul'];?></a></h2>
            <span class="blog_post_info">Diposting oleh <?php echo $video['username'];?> | <?php echo timestamp_to_date_time($video['waktu_posting']); ?></span>
            <span class="blog_post_info_right">
				<?php
					foreach($total_comments as $a){
							foreach($a as $total_comment){
								if($total_comment['id_video'] == $video['id_video']){
									echo $total_comment['total_komentar'] ." komentar";
								}
							}
					}?>
			</span>
			<div style="float:left;margin: 0 20px 10px 0;"><?php echo show_youtube($video['url'], 250, 200); ?> </div>
			<p style="height:1px"><?php echo substr($video['deskripsi'], 0, 500); ?> ....</p>
            <a class="learn_more" href="<?php echo base_url();?>videos/detail/<?php echo $video['id_video']?>">Selengkapnya</a>
       		<hr />
        </article>
   <?php } }else echo "<article class='sidebar_right'><span>Belum ada video yang diunggah.</span></article>"; ?>
   
        <article class="sidebar_right" id="pagination"></article>
        
	<div class="cleaner"></div>
    </div>
    <div class="cleaner"></div>
<?php $this->load->view('footer', $right_sidebar);?>